#ifndef __SN32F288_ST7789V_H
#define __SN32F288_ST7789V_H


/*_____ I N C L U D E S ____________________________________________________*/
#include <SN32F280.h>
#include <SN32F200_Def.h>


/*_____ D E F I N I T I O N S ______________________________________________*/


/*_____ M A C R O S ________________________________________________________*/
typedef struct
{
	uint8_t x_offset;
	uint8_t y_offset;
	
	uint8_t width;
	uint8_t height;
	
}LCD_Info_T;

extern LCD_Info_T LCD_Info;
extern uint8_t rSPI0_TimerOverCnt;
extern uint8_t rLCD_LEDA_Cnt;
#define LCD_W 160
#define LCD_H 96

#define	LCD_LEDA_ON			SN_GPIO0->BSET_b.BSET16 = 1
#define	LCD_LEDA_OFF		SN_GPIO0->BCLR_b.BCLR16 = 1
#define	LCD_LEDA_OUTPUT		SN_GPIO0->MODE_b.MODE16 = 1

#define	LCD_RESET_H			SN_GPIO0->BSET_b.BSET17 = 1
#define	LCD_RESET_L			SN_GPIO0->BCLR_b.BCLR17 = 1
#define	LED_RESET_OUTPUT 	SN_GPIO0->MODE_b.MODE17 = 1

#define	LCD_RS_CMD			SN_GPIO3->BCLR_b.BCLR14 = 1
#define	LCD_RS_DATA			SN_GPIO3->BSET_b.BSET14 = 1
#define	LED_RS_OUTPUT		SN_GPIO3->MODE_b.MODE14 = 1

#define	LCD_COLOR_WHITE			(uint16_t)(0xFFFF)
#define	LCD_COLOR_RED				(uint16_t)(0xF800)
#define LCD_COLOR_GREEN     (uint16_t)(0x07E0)
#define LCD_COLOR_BLUE      (uint16_t)(0x001F)
#define LCD_COLOR_BLACK     (uint16_t)(0x0000)

/*_____ D E C L A R A T I O N S ____________________________________________*/
extern void SPI0_DMA_TimerOut(void);
void ST7789V_Init(void);
void LCD_BLED_ON(void);
void LCD_BLED_OFF(void);
void LCD_Sleep(void);
void LCD_Wakeup(void);
void LCD_Write_Commond(uint8_t com);
void LCD_Write_Data(uint8_t data);
void LCD_SetWindows(uint16_t x_start, uint16_t y_start, uint16_t x_end, uint16_t y_end);
void LCD_Set_AreaColor(uint16_t color, uint16_t x_start, uint16_t y_start, uint16_t x_end,  uint16_t y_end);
void LCD_Display_Direction(uint8_t direction);
void LCD_FlashPicture(uint16_t sx,uint16_t sy,uint16_t x_size,uint16_t y_size,uint32_t addr);
#endif	/*__SN32F288_ST7789V_H*/
